package org.yzh.web.waterMeter.dto;

import org.yzh.framework.annotation.Property;
import org.yzh.framework.annotation.Type;
import org.yzh.framework.enums.DataType;
import org.yzh.framework.message.AbstractBody;
import org.yzh.web.waterMeter.common.WaterMeterMessageId;

import java.util.Date;
import java.util.List;

@Type(WaterMeterMessageId.WaterMeterReading)
public class WaterMeterReading extends AbstractBody {

    protected Date dateTime;
    private Integer total;
    private List<Item> list;

    @Property(index = 0, type = DataType.DATE, desc = "采集时间")
    public Date getDateTime() {
        return dateTime;
    }

    public void setDateTime(Date dateTime) {
        this.dateTime = dateTime;
    }

    @Property(index = 1, type = DataType.WORD,length = 2, desc = "数据项个数")
    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    @Property(index = 2, type = DataType.LIST, desc = "读数列表")
    public List<Item> getList() {
        return list;
    }

    public void setList(List<Item> list) {
        this.list = list;
    }

    public static class Item {

        private String terminalId;
        private Double reading;
        private Integer status;

        @Property(index = 0, type = DataType.BCD8421,length = 6, desc = "水表编码")
        public String getTerminalId() {
            return terminalId;
        }

        public void setTerminalId(String terminalId) {
            this.terminalId = terminalId;
        }

        @Property(index = 1, type = DataType.READING, desc = "读数")
        public Double getReading() {
            return reading;
        }

        public void setReading(Double reading) {
            this.reading = reading;
        }

        @Property(index = 2, type = DataType.WORD, desc = "状态")
        public Integer getStatus() {
            return status;
        }

        public void setStatus(Integer status) {
            this.status = status;
        }
    }
}